#ifndef _MAINFORM_H_
#define _MAINFORM_H_

#include <QMessageBox>
#include <QMenu>
#include <QDir>
#include <QPluginLoader>
#include <QTcpSocket>
#include <QTcpServer>

#include "codecs/CodecInterface.h"

#include "settingsdialog.h"

#include "ui_mainformbase.h"

class MainForm : public QWidget, private Ui::MainFormBase
{
	Q_OBJECT

public:
	MainForm();
	void loadCodecs();
	void debugMessage(QtMsgType, const char*);

public slots:
	void connectToServer();
	void disconnectFromServer();
	void readDataFromServer();

	void listenForClient();
	void deafForClient();
	void readDataFromClient();

private:
	QTcpSocket *m_Client_Socket, *m_Server_Peer;
	QTcpServer *m_Server_Socket;
	bool m_Autoconnect;
	QString m_Line;
	QMenu *m_CodecsMenu;
	QList<CodecInterface*> m_CodecsList;
	CodecInterface *m_ActiveCodec;
	
	SettingsDialog *m_SettingsDialog;

private slots:
	void menu_about();
	void switchView();
	void updateInterface();
	void updateActiveCodec(QAction*);
	void configureActiveCodec();
	void execSettingsDialog();

	void getPeer();
	void dropPeer();
	void socketStateChanged(QAbstractSocket::SocketState);
};

#endif

// kate: space-indent off; tab-indents on; indent-width 4; indent-mode cstyle;
